const baseMixin = {
  data () {
    return {
      ruleForm: {}
    };
  },
  props: ["changFormData"],
  methods: {
    childSubmit () {
      return new Promise((resolve, reject) => {
        this.$refs.ruleForm.validate((valid) => {
          if (valid) {
            this.changFormData(this.ruleForm);
            resolve(valid);
          } else {
            console.log(valid);
          }
        });
      });
    },
    childSure () {
      return new Promise((resolve, reject) => {
        this.changFormData(this.ruleForm);
        resolve();
      });
    },
    resetForm () {
      this.$refs.ruleForm.resetFields();
    }
  }
};

export default baseMixin;
